package com.yundingai.domain.dto;

import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @Author: liyuxiang
 * @Date: 2025/7/17 18:40
 */
@Data
public class PlanDTO {
    @JsonPropertyDescription("学习计划总标题")
    private String planName;
    @JsonPropertyDescription("学习计划内容，包含每周计划和学习建议")
    private List<Week> weeks;
    @JsonPropertyDescription("学习建议列表")
    private List<String> advice;

    @Data
    public static class Week {
        private Object week;
        @JsonPropertyDescription("计划标题")
        private String title;
        @JsonPropertyDescription("周状态")
        private String status;
        @JsonPropertyDescription("周内容列表")
        private List<Content> content;
        @JsonPropertyDescription("周练习")
        private String exercise;


    }
    @Data
    public static class Content {
        @JsonPropertyDescription("内容主题")
        private String topic;
        @JsonPropertyDescription("内容状态")
        private boolean status;
        @JsonPropertyDescription("完成时间")
        private Date completionTime;


    }
    public String toJson() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
        }
    }
}
